package io.renren.modules.substation.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.substation.dao.TBaseLoginLogDao;
import io.renren.modules.substation.entity.TBaseLoginLogEntity;
import io.renren.modules.substation.service.TBaseLoginLogService;


@Service("tBaseLoginLogService")
public class TBaseLoginLogServiceImpl extends ServiceImpl<TBaseLoginLogDao, TBaseLoginLogEntity> implements TBaseLoginLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String userName = (String)params.get("userName");
        IPage<TBaseLoginLogEntity> page = this.page(
                new Query<TBaseLoginLogEntity>().getPage(params),
                new QueryWrapper<TBaseLoginLogEntity>()
                        .like(StringUtils.isNotBlank(userName),"OPERATOR_CODE", userName)
                        .orderByDesc("CREATE_TIME")
        );

        return new PageUtils(page);
    }

}